﻿@model SimpleTaskManager.Domain.Entities.User

@{
    ViewBag.Title = "Details";
}

<fieldset id="userDetails">
    <legend>@Html.DisplayFor(model => model.FirstName) @Html.DisplayFor(model => model.LastName)</legend>

    <table>
        <tr>
            <td>
                <fieldset>
                    <legend>Personal details</legend>

                    <div class="display-label">First Name</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.FirstName)
                    </div>
                    <br />

                    <div class="display-label">Last Name</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.LastName)
                    </div>
                    <br />
        
                    <div class="display-label">Date of birth</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.DateOfBirth)
                    </div>
                    <br />

                     <div class="display-label">Personal Identifier</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.PersonalIdentifier)
                    </div>
                    <br />

                    <div class="display-label">Login</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Login)
                    </div>     
                </fieldset>

                 <fieldset>
                    <legend>Contact details</legend>
        
                    <div class="display-label">E-mail</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Email)
                    </div>
                    <br />

                    <div class="display-label">Phone</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Phone)
                    </div>
                    <br />

                    <div class="display-label">Address</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Address)
                        <br />
                        @Html.DisplayFor(model => model.City), @Html.DisplayFor(model => model.ZIP)
                        <br />
                        @Html.DisplayFor(model => model.Country)
                    </div>

                </fieldset>
            </td>
            <td>
                <fieldset>
                    <legend>Company details</legend>
                    <div class="display-label">Role</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Role)
                    </div>
                    <br />
                    <div class="display-label">Position</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Position)
                    </div>
                    <br />

                    <div class="display-label">With us since</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.CreationDate)
                    </div>
                    <br />

                    <div class="display-label">Status</div>
                    <div class="display-field">
                        @Html.DisplayFor(model => model.Status)
                    </div>
                    <br />
                </fieldset>

                <fieldset>
                    <legend>Skills</legend>
                    @if (ViewBag.UserSkills)
                    {
                        <ul>
                        @foreach(SimpleTaskManager.Domain.Entities.User_Skill skill in Model.User_Skills) {
                            <li>@skill.Skill.Name (@skill.Rating)</li>
                        }
                        </ul>
                    }

                </fieldset>

                <fieldset>
                    <legend>All tasks</legend>
                    @if (ViewBag.UserTasks)
                    {
                        <ul>
                        @foreach(SimpleTaskManager.Domain.Entities.Task task in Model.Tasks.Union(Model.LeaderOf)) {
                            <li>@Html.ActionLink(task.Name, "Details", "Task", new { id = task.TaskID }, null) @((string.IsNullOrEmpty(task.Description)) ? "" : "|") @task.Description | @task.Status</li>
                        }
                        </ul>
                    }
                </fieldset>

                <fieldset>
                    <legend>Hours</legend>
                    <ul>
                        <li>This week: @ViewBag.ThisWeek h</li>
                        <li>This month: @ViewBag.ThisMonth h</li>
                        <li>Last month: @ViewBag.LastMonth h</li>
                    </ul>
                    @Html.ActionLink("Details", "Hours", new { id = Model.UserID })
                    <!-- Hours in work last month: x h
                         Hours in work this month: y h
                         Hours in work this week: z h
                         Details button-->
                </fieldset>
            
            </td>
        </tr>
    </table>

</fieldset>
<p>
    @Html.ActionLink("Edit", "Edit", new { id=Model.UserID }) |
    @Html.ActionLink("Back to List", "Index")
</p>
